{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[  1.      ,   1.719686,  33.878743],\n",
       "       [  1.      ,   2.407117,  36.628469],\n",
       "       [  1.      ,   6.063751,  51.255004],\n",
       "       ..., \n",
       "       [  1.      ,   1.146853,  31.587411],\n",
       "       [  1.      ,   1.614244,  33.456975],\n",
       "       [  1.      ,   6.154915,  51.619659]])"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#!/usr/bin/env python3\n",
    "\n",
    "import random\n",
    "import argparse\n",
    "import numpy as np\n",
    "\n",
    "\n",
    "# dataset file\n",
    "DATASET_FILE = \"LinearRegressionDataSet_2.txt\"\n",
    "dataset = np.loadtxt(DATASET_FILE, dtype=np.float64)\n",
    "dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def generate_min_batch(dataset, batch_size):\n",
    "    \"\"\"\n",
    "    Generate Min Batch.\n",
    "    \"\"\"\n",
    "    dataset_shape = dataset.shape\n",
    "    if dataset_shape[0] < batch_size:\n",
    "        batch_size = dataset_shape[0]\n",
    "\n",
    "    row_indexes = [i for i in range(dataset_shape[0])]\n",
    "    random.shuffle(row_indexes)\n",
    "    random_row_indexes = row_indexes[:batch_size]\n",
    "    hsplit_indice = dataset_shape[1] - 1\n",
    "    random_dataset = (dataset[random_row_indexes, :hsplit_indice],\n",
    "                      dataset[random_row_indexes, hsplit_indice:])\n",
    "    return random_dataset\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
